package org.nio;

import java.io.*;
import java.nio.channels.FileChannel;

/**
 * @author wind
 * @create 2025-01-02 17:06
 */
public class ChannelDemo {
    public static void main(String[] args) throws IOException {
        /*FileChannel from = new FileInputStream("Data.txt").getChannel();
        FileChannel to = new FileOutputStream("3parts.txt").getChannel();
        from.transferTo(0, from.size(), to);*/

        FileChannel from = new RandomAccessFile("Data.txt", "rw").getChannel();
        FileChannel to = new RandomAccessFile("3parts.txt", "rw").getChannel();
        from.transferTo(0, from.size(), to);
    }
}
